
$MOD51
	ORG	00H
MAIN:
lcall	kieu_1

ljmp main

; chuong trinh con
kieu_1:

	MOV	R0,#00H
	;TAT TAT CA CAC PORT
	mov 	p0,#00H 
	MOV	P1,#00H
	MOV	P2,#00H
	MOV 	P3,#00H
STAR1:
	
	MOV	DPTR,#DATADISP1 ;CSDL DIEU KHIEN CAC BIT
	MOV	A,R0
	MOVC	A,@A+DPTR
	MOV	P0,A ; PORT DUOC NAP DU LIEU VAO
	
LCALL	DELAY1
	INC R0
	CJNE	R0,#16,star1 ;THAY DOI SO NAY THEO CSDL
	RET

;nhom lenh cac vong lap
DELAY1:
	PUSH	00H
	MOV	R0,#70
	MOV	TMOD,#01H
LOOP1:
	MOV	TH0,#HIGH(-8000);CHINH TOC DO
	MOV	TL0,#LOW(-8000);CHINH TOC DO
	SETB	TR0
 	JNB	TF0,$
	CLR	TR0
	CLR	TF0
	DJNZ	R0,LOOP1
	POP	00H
	RET


;-----------------------------------
;du lieu dung de dieu khien

DATADISP1:
DB	00000001B,00000010B,00000100B,00001000B,00000001B,00000010B,00000100B,00001000B,
DB	10000000B,01000010B,00000100B,00001000B,00000001B,00000010B,00000100B,00001000B,
DB	10000000B,01000010B,00000100B,00001000B,00000001B,00000010B,00000100B,00001000B,
DB	10000000B,01000010B,00000100B,00001000B,00000001B,00000010B,00000100B,00001000B,


end


